﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Guitar.Vues;

namespace Guitar.Vues
{
    /// <summary>
    /// Logique d'interaction pour Corde.xaml
    /// </summary>
    public partial class VueLigne : UserControl
    {

        public int _NumLigne = 0; // Permet de savoir le numero de la ligne
        public int NumLigne
        {
            get { return _NumLigne; }

            set
            {
                _NumLigne = value;
            }
        }

        // Using a DependencyProperty as the backing store for IsConnected.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NumLigneProperty =
         DependencyProperty.Register("NumLigne", typeof(int), typeof(VueLigne), new PropertyMetadata(new PropertyChangedCallback((o, e) => (o as VueLigne).NumLigne = (int)e.NewValue)));




        private bool _IsSubline = false; // Permet de savoir si la ligne est une ligne de dépassement de portée
        public bool IsSubline
        {
            get { return _IsSubline; }

            set
            {
                _IsSubline = value;

                if (_IsSubline)
                {
                    corde.Visibility = Visibility.Hidden;
                }
                else { corde.Visibility = Visibility.Visible; }
            }


        }

        // Using a DependencyProperty as the backing store for IsConnected.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsSublineProperty =
            DependencyProperty.Register("IsSubline", typeof(bool), typeof(VueLigne), new PropertyMetadata(new PropertyChangedCallback((o, e) => (o as VueLigne).IsSubline = (bool)e.NewValue)));



        private bool _IsTabLine = false; // Permet de savoir si la ligne est une ligne de portée ou tablature
        public bool IsTabLine
        {
            get { return _IsTabLine; }

            set
            {
                _IsTabLine = value;
            }

        }

        
        public static readonly DependencyProperty IsTabLineProperty =
            DependencyProperty.Register("IsTabLine", typeof(bool), typeof(VueLigne), new PropertyMetadata(new PropertyChangedCallback((o, e) => (o as VueLigne).IsTabLine = (bool)e.NewValue)));

        public VueLigne()
        {
            InitializeComponent();
        }


        private void corde_MouseEnter(object sender, MouseEventArgs e)
        {
            if (IsSubline)
            {
                corde.Visibility = Visibility.Visible;
            }
        }

        private void corde_MouseLeave(object sender, MouseEventArgs e)
        {
            if (IsSubline)
            {
                corde.Visibility = Visibility.Hidden;      
            }
        }

    }
}
